package utils;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;

/**
 * @author : niu niu
 * @version : 1.0.0
 * @date : 2023/4/8 15:53
 */
public class JSONUtils {
    private static ObjectMapper mapper  = null;
    static {
        mapper = new ObjectMapper();
    }
    public static ObjectMapper getMapper(){
        return mapper;
    }
    public static String toJSON (Object o) throws JsonProcessingException {

        return mapper.writeValueAsString(o);
    }
}
